package parser

import (
	"goruntimeDistributionCrawler/engine"
	"regexp"
)

const cityListEx  =  `{linkContent:"([^征婚]*)征婚",linkURL:"(http://m.zhenai.com/zhenghun/[^"]*)"}`
//const cityListEx  =  `<a href="(http://www.zhenai.com/zhenghun/[^"]*)" [^>]*>([^</a>]*)</a>`

func PaseCityList(contens []byte,_ string) engine.ParseResult{
	re:=regexp.MustCompile(cityListEx)
	matches:=re.FindAllSubmatch(contens,-1)

	result:=engine.ParseResult{}
	for _,m:=range matches{
		//result.Items=append(result.Items,string(m[1]))
		url:=string(m[2])
		result.Requests=append(result.Requests,engine.Request{
			UrL:string(url),
			Parser:engine.NewParserFunc(
				ParserProfilList,"ParserProfilList"),
		})
	}
    return result
}

